
let user:object = {
    name:"tom",
    age:"23"
} 

// 类型接口 => 定义对象数据的描述说明
interface User {
    name:string,
    age:number,
    sex?:string
}

let user1:User = {
    name:"admin",
    age:12,
    sex:"m"
}

let user2:User = {
    name:"admin",
    age:12
}

// 等同于ES6的class
class Stu {
    name:string = "";
    age:number = 0;
    sex:string = "";
}

let s1 = new Stu()

let s2:Stu = {
    name:"admin",
    age:12,
    sex:"m"
}
let s3:Stu = new Stu();

class Parent {
    a:string = "";
    b?:boolean = false;
} 
class Child extends Parent {
    c:number = 0;
    d?:number[] = [];
}

let arg1:Child = {
    a:"aa",
    c:0
}
let arg2:Child = {
    a:"aa",
    b:true,
    c:0,
    d:[1,2,3]
}

